﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GH.BLL;
using System.Data;
using GH.Model;


    public partial class VipAdd : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                //绑定单位信息
                Union bllUnion = new Union();
                DataSet dsResult= bllUnion.GetAllList();
                ddl单位.DataSource = dsResult;
                ddl单位.DataTextField = "单位名称";
                ddl单位.DataValueField = "ID";
                ddl单位.DataBind();

                //绑定部门信息
                DepartMent bllDepartMent = new DepartMent();
                DataSet dsResultDepartMent = bllDepartMent.GetAllList();
                ddl部门.DataSource = dsResultDepartMent;
                ddl部门.DataTextField = "部门名称";
                ddl部门.DataValueField = "ID";
                ddl部门.DataBind();

                //DepartMent bllDepartMent = new DepartMent();
                //bllDepartMent

                //VipMember bllVipMember = new VipMember();
                //GH.Model.会员基本信息 model = bllVipMember.GetModel(this.re
            }

        }

        protected void btnAdd_Click(object sender, ImageClickEventArgs e)
        {
            try
            {

                GH.Model.会员基本信息 model = new GH.Model.会员基本信息();
                //model.ID = ID;
                model.身份证号 = string.Empty;
                model.姓名 = txt姓名.Text;
                model.性别 = ddl性别.SelectedValue;
               model.出生年月日 = System.DateTime.Now;
                model.籍贯 = txt籍贯.Text;
                model.收入 = txt收入.Text;
                model.联系电话 = txt联席电话.Text;
                model.家庭住址 = txt家庭地址.Text;
                model.文化程度 = string.Empty;
                model.政治面貌 = string.Empty;
                model.单位 = int.Parse(ddl单位.SelectedValue);
                model.部门 = int.Parse(ddl部门.SelectedValue);
                model.班组 = 0;
                model.职称 = txt职称.Text;
                model.连续工龄 = txt连续工龄.Text;
                model.本企业工龄 = txt本企业工龄.Text;
                model.有害人体健康工作 = txt有害人体.Text;
                model.会员区分 = rd是否会员.SelectedValue;
                model.会员证号 = txt会员编号.Text;
                model.入会时间 = System.DateTime.Now;
                model.属性 = string.Empty;
                model.调进调出原因 = txt调出掉进原因.Text;
                model.工作经历 = txt工作经历.Text;
                model.备注 = txt备注.Text;

                VipMember bllVipMember = new VipMember();
                bllVipMember.Add(model);

                AlertMessage("更新成功");
                btnFamily.Enabled = true;
            }
            catch
            {
                AlertMessage("更新失败");
            }
           
        }

        protected void btnFamily_Click(object sender, ImageClickEventArgs e)
        {
            this.Response.Redirect("VipFamilyList.aspx");
        }
    }
